package com.geek.java.ch02;

    //私有属性
    public class Teacher {
    private String name;
    private int age;
    private long num;
    private char gender;
    public String major;

    //成员方法
    public void teacher(){System.out.println("一位"+major+"学科的老师正在教学" );}
    public void sleep(){System.out.println(name+"正在睡觉");}

    //构造方法
    public Teacher(){

    }

    public Teacher(String name, int age, long num, char gender, String major) {
        this.name = name;
        this.age = age;
        this.num = num;
        this.gender = gender;
        this.major = major;
    }
    public String getName() { return name; }
        public void setName(String name) { this.name = name; }
        public int getAge() { return age; }
        public void setAge(int age) { this.age = age; }
        public long getNum() { return num; }
        public void setNum(long num) { this.num = num; }
        public char getGender() { return gender; }
        public void setGender(char gender) { this.gender = gender; }
        public String getMajor() { return major; }
        public void setMajor(String major) { this.major = major; }

        //toString 输出对象信息
        public String toString() {
        return "Teacher [name=" + name + ", age=" + age + ", num=" + num + ", gender=" + gender;
        }


    }


